<template>
  <div class="tabs">
    <div
      class="tabs-item colorWhite"
      :class="{ current: tabIndex == index }"
      @click="change(item, index)"
      v-for="(item, index) in tabsData"
      :key="index"
    >
      {{ item }}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    tabsData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      tabIndex: 0,
    };
  },
  methods: {
    change(item, index) {
      this.tabIndex = index;
      this.$emit("changeTab", { item, index });
    },
  },
};
</script>

<style lang="less" scoped>
.tabs {
  display: flex;
  // justify-content: space-evenly;

  .tabs-item {
    cursor: pointer;
    padding: 3px 11px;
    border: 1px solid #3c98ff;
    margin: 0 10px;
    font-size: 14px;
  }
  .current {
    background-color: #3c98ff;
  }
}
</style>
